package com.pktechan.api.enumeration;

/**
 * @program: cloudfloating
 * @description: 订单状态改变事件枚举
 * @author: qx.zhang
 * @create: 2021-03-15 11:27
 **/
public enum ChangeTradeOrderStatusEnum {

    PLACE_ORDER(1010, "下单"),
    PAY_ORDER(1020, "支付成功"),
    TRANSFER_ORDER(2020, "转让订单"),
    DELIVERY_ORDER(2030, "配送商接单"),
    COMPLETE_ORDER(3040, "配送完成"),
    CLOSE_ORDER(-1010, "超时关闭"),
    REFUND_ORDER(-2020, "客户退款"),
    COMPLETE_ORDER_REFUND(-2030, "已退款");

    private Integer code;
    private String name;

    ChangeTradeOrderStatusEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static String getNameByCode(Integer code) {
        for (ChangeTradeOrderStatusEnum statusEnum : ChangeTradeOrderStatusEnum.values()) {
            if (statusEnum.code.equals(code)) {
                return statusEnum.name;
            }
        }
        return null;
    }
}
